import request from '@/router/axios';
// url: `http://192.168.1.152:1888/resource/list`,
// /api/menu/listTree
export const getMenuTree = () => {
	return request({
		url: `/api/menu/listTree`,
		method: 'post'
	})
}

export const setAuthority = (obj) => {
	return request({
		url: `/api/resource/setAuthority`,
		method: 'post',
		meta: {
			isSerialize: true
		},
		data: {
			...obj
		}
	})
}

export const getList = (page, size, params) => {
	return request({
		url: '/api/resource/list',
		method: 'post',
		meta: {
			isSerialize: true
		},
		data: {
			...params,
			page,
			size
		}
	})
}

export const delrowData = (menuId) => {
	return request({
		url: '/api/menu/remove',
		method: 'get',
        meta: {
            isSerialize: true
        },
        params: {
			menuId: menuId
		}
	})
}
export const add = (row) => {
	return request({
		url: '/api/menu/add',
		method: 'post',
		meta: {
			isSerialize: true,
		},
        data: row
	})
}

export const update = (row) => {
	return request({
		url: '/api/menu/edit',
		method: 'post',
		meta: {
			isSerialize: true,
		},
		data: row
	})
}

export const getMenu = (menuId) => {
	return request({
		url: `/api/menu/view/${menuId}`,
		method: 'post',
		meta: {
			isSerialize: true,
		},
		data: {}
	})
}
export const updatalist = (menuId) => {
	return request({
		url: '/api/menu/list',
		method: 'get',
		params: {
			menuId
		}
	})

}
export const resuceDel = (row) => {
	return request({
		url: '/api/resource/delete',
		method: 'post',
		data: row
	})
}
export const resourceDelete = (resourceId) => {
	return request({
		url: '/api/resource/deleteAuthority',
		method: 'get',
		params: {
			resourceId
		}
	})
}
